package com.goldcn.user.controller;

import com.goldcn.user.dto.WechatAuthDTO;
import com.goldcn.user.model.UserApply;
import com.goldcn.user.service.UserAuthService;
import com.goldcn.user.service.UserTransferService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections.MapUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * Created by 1111 on 2016/11/10.
 */
@Api(value = "微信用户授权")
@RestController
@RequestMapping(value = "/wxauth")
public class WechatAuthController {
    @Autowired
    UserAuthService userAuthService;

    @ApiOperation(value = "建立微信用户授权")
    @RequestMapping(method = RequestMethod.POST)
    public Object addWxAuth(@RequestBody WechatAuthDTO wechatAuthDTO) {
        return userAuthService.addUserByWechatAuth(wechatAuthDTO);
    }


    @ApiOperation(value = "微信用户授权登录")
    @RequestMapping(value = "/login", method = RequestMethod.POST)
    public Object doWxAuthLogin(@RequestBody WechatAuthDTO wechatAuthDTO) {
        return userAuthService.getUserByWechatAuth(wechatAuthDTO);
    }


}
